package com.abso.sunlight.explorer.wizards;

import java.io.File;
import java.util.List;

import org.eclipse.core.runtime.IProgressMonitor;

import com.abso.sunlight.api.Legislator;
import com.abso.sunlight.api.SunlightException;

/**
 * A specialized wizard able to export a list of legislators into a Excel spreadsheet.
 */
public class ExportExcelWizard extends ExportFileWizard {

    /**
     * Constructs a new wizard.
     * 
     * @param allLegislators
     *            the list of all legislators returned by a specific query and listed into a editor.
     * @param selectedLegislators
     *            the list of legislators selected into a editor.
     * @param initialExportAll
     *            indicates if the initial option must be either to export all legislators or the selected ones only.
     */
    public ExportExcelWizard(List<Legislator> allLegislators, List<Legislator> selectedLegislators, boolean initialExportAll) {
        super(allLegislators, selectedLegislators, initialExportAll);
    }

    @Override
    protected ExportFileWizardPage createExportPage() {
        return new ExportExcelWizardPage();
    }

    @Override
    protected String getWizardTitle() {
        return "Export Excel";
    }

    @Override
    protected void doExport(List<Legislator> legislators, File file, boolean includePhotos, IProgressMonitor monitor)
            throws SunlightException {
        ExcelExporter exporter = new ExcelExporter(legislators, file);
        exporter.export(monitor);
    }

}
